#include "testApp.h"

//--------------------------------------------------------------
void testApp::setup(){

	myVideoGrabber.initGrabber(320,240);
	
	videoColorImage.allocate(myVideoGrabber.width, myVideoGrabber.height);
	
	videoGrayImage.allocate(myVideoGrabber.width, myVideoGrabber.height);
	
		
	// set background color to be white: 
	ofBackground(255, 255, 255);
}

//--------------------------------------------------------------
void testApp::update(){
	
	
	myVideoGrabber.grabFrame();
	if (myVideoGrabber.isFrameNew()){
		videoColorImage.setFromPixels(myVideoGrabber.getPixels(), myVideoGrabber.width, myVideoGrabber.height);
		videoGrayImage = videoColorImage;
		videoGrayImage.blur(33);
	}
}

//--------------------------------------------------------------
void testApp::draw(){
	
	// when we draw, the drawing color "tints" the drawing, so white is best for image
	// ie, white = no tint.
	ofSetColor(255, 255, 255);
	myVideoGrabber.draw(0,0);
	videoGrayImage.draw(myVideoGrabber.width,0);
}

//--------------------------------------------------------------
void testApp::keyPressed(int key){

}

//--------------------------------------------------------------
void testApp::keyReleased(int key){

}

//--------------------------------------------------------------
void testApp::mouseMoved(int x, int y ){

}

//--------------------------------------------------------------
void testApp::mouseDragged(int x, int y, int button){

}

//--------------------------------------------------------------
void testApp::mousePressed(int x, int y, int button){
	
}

//--------------------------------------------------------------
void testApp::mouseReleased(int x, int y, int button){

}

//--------------------------------------------------------------
void testApp::windowResized(int w, int h){

}

